package network.editor;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import xujun.control.XContorlUtil;
import xujun.control.taskpanel.JTaskPane;
import xujun.control.taskpanel.JTaskPaneGroup;

/**
 * 
 * @author zhangzuoqiang <br/>
 *         Date: Aug 25, 2011
 */
public class EditorTaskPanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public EditorTaskPanel() {
		JTaskPane taskPane = new JTaskPane();
		// image vertex group
		JTaskPaneGroup imageVertexGroup = new JTaskPaneGroup();
		imageVertexGroup.setTitle("图形");
		imageVertexGroup.setFont(XContorlUtil.FONT_14_PLAIN);
		imageVertexGroup.setToolTipText("");
		imageVertexGroup.setSpecial(true);
		imageVertexGroup.setIcon(XContorlUtil
				.getImageIcon("images/image_title.png"));
		imageVertexGroup.add(new EditorImageVertexPanel());
		taskPane.add(imageVertexGroup);
		// edge group
		JTaskPaneGroup edgeGroup = new JTaskPaneGroup();
		edgeGroup.setTitle("连线");
		edgeGroup.setFont(XContorlUtil.FONT_14_PLAIN);
		edgeGroup.setToolTipText("");
		edgeGroup.setSpecial(true);
		edgeGroup.setIcon(XContorlUtil.getImageIcon("images/edge_title.png"));
		edgeGroup.add(new EditorEdgePanel());
		taskPane.add(edgeGroup);
		// geo group
		JTaskPaneGroup geoGroup = new JTaskPaneGroup();
		geoGroup.setTitle("几何");
		geoGroup.setFont(XContorlUtil.FONT_14_PLAIN);
		geoGroup.setToolTipText("");
		geoGroup.setSpecial(true);
		geoGroup.setIcon(XContorlUtil.getImageIcon("images/geo_title.png"));
		geoGroup.add(new EditorGeoVertexPanel());
		taskPane.add(geoGroup);

		// 加一个滚动，防止溢出
		JScrollPane scroll = new JScrollPane(taskPane);
		scroll.setBorder(null);

		setLayout(new BorderLayout());
		add("Center", scroll);
	}

	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(3);
		frame.getContentPane().add(new EditorTaskPanel());
		frame.setVisible(true);

		frame.pack();
	}
}